package cn.falconnect.adserver.adapter.persistence.dao;

import java.util.List;

import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import cn.falconnect.adserver.adapter.persistence.typehandler.EnumStatusTypeHandler;
import cn.falconnect.adserver.domain.ad.AdMaterialAudit;

@Component
public interface AdMaterialAuditDao {

	@Results(value = { @Result(column = "id", property = "id", id = true),
			@Result(column = "ad_format_id", property = "adFormat",typeHandler=EnumStatusTypeHandler.class),
			@Result(column = "audit_id", property = "auditId"),
			@Result(column = "material_id", property = "materialId"),
			@Result(column = "creative_id", property = "creativeId"),
			@Result(column = "size_name", property = "sizeName"),
			@Result(column = "audit_status", property = "auditStatus"),
			@Result(column = "audit_message", property = "auditMessage"),
			@Result(column = "platform_id", property = "platformId"),
			@Result(column = "create_time", property = "createTime"),
			@Result(column = "update_time", property = "updateTime")
	})
	@Select("select * from ad_material_audit")
	List<AdMaterialAudit> findAll();

	@Results(value = { @Result(column = "id", property = "id", id = true),
			@Result(column = "ad_format_id", property = "adFormat",typeHandler=EnumStatusTypeHandler.class),
			@Result(column = "audit_id", property = "auditId"),
			@Result(column = "material_id", property = "materialId"),
			@Result(column = "creative_id", property = "creativeId"),
			@Result(column = "size_name", property = "sizeName"),
			@Result(column = "audit_status", property = "auditStatus"),
			@Result(column = "audit_message", property = "auditMessage"),
			@Result(column = "platform_id", property = "platformId"),
			@Result(column = "create_time", property = "createTime"),
			@Result(column = "update_time", property = "updateTime")
	})
	@Select("select * from ad_material_audit where update_time >= #{value}")
	List<AdMaterialAudit> findAfterTime(String warmUpTime);

}
